home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Type casting
- Date: Tue, 27 Feb 96 22:35:16 GMT
- Organization: none
- Message-ID: <825460516snz@genesis.demon.co.uk>
- References: <4gfnmi$gsc@calvin.risq.qc.ca> <4gim30INNo4b@keats.ugrad.cs.ubc.ca> <4gkki1$a7c@charm.il.ft.hse.nl>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4gkki1$a7c@charm.il.ft.hse.nl> robert@il.ft.hse.nl "robert" writes:
-
- >c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku):
- > >In article <4gfnmi$gsc@calvin.risq.qc.ca>,
- > >Pierre Coulombe <pcoulomb@criq.qc.ca> wrote:
- > >> char string[80];
- > >> strcpy(string, "25.4");
- > >Try char *string = "25.4". This is a waste.
- > >> sprintf(string, "%f", (float) atof(string) * MM_TO_UNITS);
- > ^^^^^^
- >It's not a waste, you can't be certain the result will fit in the 4
- >chars.
-
- It also tries to write to a string literal which is illegal.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-